<template>
  <div class="app-logo">
    <img class="logo-img" :src="vueIcon" alt="logo" :title="appTitle" />
    <h1 class="app-title" v-if="!isMenuCollapse || showTitle">{{ appTitle }}</h1>
  </div>
</template>

<script setup>
import { useThemeStore } from '@/stores/theme'
import vueIcon from '@/assets/logo/logo.png'

const props = defineProps({
  showTitle: {
    type: Boolean,
    default: false,
  },
})

const themeStore = useThemeStore()
const { isMenuCollapse } = storeToRefs(themeStore)

const appTitle = computed(() => WEB_CONFIG.title)
</script>

<style lang="scss" scoped>
.app-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 var(--base-gap);

  .logo-img {
    width: 32px;
    height: 32px;
  }

  .app-title {
    font-size: 1rem;
  }
}
</style>
